package com.example.oom;

import java.util.ArrayList;
import java.util.List;

/**
 * 模拟 java.lang.OutOfMemoryError: GC Overhead limit exceeded
 * -Xmx64m
 */
public class GCOverheadLimitExceeded {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        int i = 0;
        while (true) {
            list.add(String.valueOf(i++).intern());
        }
    }
}
